/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.swirrel.listener;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import org.swirrel.util.MethodCall;
import org.swirrel.util.SwirrelException;

/**
 *
 * @author Gronau
 */
public class SwirrelPropertyChangeListener
    extends AbstractSwirrelListener implements PropertyChangeListener {

  private final MethodCall propertyChangeCall;

  public SwirrelPropertyChangeListener(MethodCall propertyChangeCall) {
    this.propertyChangeCall = propertyChangeCall;
    if (!checkSignature(propertyChangeCall, PropertyChangeEvent.class)) {
      throw new SwirrelException(
          "Method must have none or one ActionEvent argument");
    }
  }

  public void propertyChange(PropertyChangeEvent e) {
    call(propertyChangeCall, e);
  }
}
